home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- ///////////////////////////////////////////////////////////////////////////
- // OkTStructArray.c++
- ///////////////////////////////////////////////////////////////////////////
- #include "OkTStructArray.h"
-
- template <class Type>
- OkTStructArray<Type>::OkTStructArray() :
- OkArray( sizeof( Type ) )
- {
- if (data) createElements(data,num);
- }
-
- template <class Type>
- OkTStructArray<Type>::OkTStructArray( OkTStructArray<Type>& a ) :
- OkArray( a.elementsize )
- {
- maxi = a.maxi; num = a.num; data = a.raw_copy();
- }
-
- template <class Type>
- OkTStructArray<Type>::OkTStructArray( u_int size ) :
- OkArray( sizeof(Type), size )
- {
- createElements(data,num);
- }
-
- // Protected constructor.
- template <class Type>
- OkTStructArray<Type>::OkTStructArray(u_int esize, u_int num, void * data) :
- OkArray(esize,num,data)
- {
- // Do nothing.
- }
-
-
- template <class Type>
- OkTStructArray<Type>::~OkTStructArray()
- {
- destroy();
- }
-
-
- template <class Type> OkTStructArray<Type>
- OkTStructArray<Type>::cut(u_int start, u_int len)
- {
- return OkTStructArray<Type>( sizeof(Type), len*sizeof( Type ),
- raw_cut(start,len) );
- }
-
- template <class Type> OkTStructArray<Type>
- OkTStructArray<Type>::extract(u_int start, u_int len)
- {
- return OkTStructArray<Type>( sizeof(Type), len*sizeof( Type ),
- raw_extract(start,len) );
- }
-
- template <class Type> OkTStructArray<Type>
- OkTStructArray<Type>::head(u_int len)
- {
- return OkTStructArray<Type>( sizeof(Type), len*sizeof( Type ), raw_head(len) );
- }
-
- template <class Type> OkTStructArray<Type>
- OkTStructArray<Type>::tail(u_int len)
- {
- return OkTStructArray<Type>( sizeof(Type), len*sizeof( Type ), raw_tail(len) );
- }
-
-
- template <class Type> void
- OkTStructArray<Type>::operator=(OkTStructArray<Type>&a)
- {
- maxi = a.maxi; num = a.num; if (data) delete (void*)data;
- data = a.raw_copy();
- }
-
-
- template <class Type> Type&
- OkTStructArray<Type>::operator[](u_int index)
- {
- assert(index>=0 && index*sizeof( Type ) < num);
- return *(Type *)((char*)((void*)data) + index * sizeof( Type ));
- }
-
- template <class Type> void
- OkTStructArray<Type>::append(Type & item)
- {
- OkArray::append(&item);
- }
-
- template <class Type> void
- OkTStructArray<Type>::append(OkTStructArray<Type> & a)
- {
- OkArray::append(a);
- }
-
- template <class Type> void
- OkTStructArray<Type>::remove(u_int start, u_int length)
- {
- OkArray::remove(start,length);
- }
-
- template <class Type> void
- OkTStructArray<Type>::removeAll()
- {
- OkArray::remove(0, OkArray::length());
- }
-
- template <class Type> void
- OkTStructArray<Type>::insert(OkTStructArray<Type> & a, u_int p)
- {
- OkArray::insert(a,p);
- }
-
- template <class Type> void
- OkTStructArray<Type>::insert(Type & item, u_int p)
- {
- OkArray::insert(&item,p);
- }
-
- template <class Type> int
- OkTStructArray<Type>::find(Type& x, u_int start)
- {
- return OkArray::find(&x,start);
- }
-
-
- template <class Type> int
- OkTStructArray<Type>::compareElements(void *o1, void *o2)
- {
- return compareElements( *(Type *)o1, *(Type *)o2 );
- }
-
- template <class Type> int
- OkTStructArray<Type>::compareElements(Type o1, Type o2)
- {
- return OkArray::compareElements( &o1, &o2 );
- }
-
- template <class Type> void
- OkTStructArray<Type>::destroyElements(void *start , u_int nbytes )
- {
- OkArray::destroyElements( start, nbytes );
- }
-
-